package com.zhongxiangspace.service.impl;

import com.zhongxiangspace.entity.House;
import com.zhongxiangspace.entity.QueryAnalyzer;
import com.zhongxiangspace.mapper.HouseMapper;
import com.zhongxiangspace.service.HouseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * 房源
 */
@Service
public class HoueseServiceImpl implements HouseService {

    @Autowired
    private HouseMapper houseMapper;
    /**@
     * 插入数据
     * @param house
     * @return
     */
    @Override
    @Transactional
    public boolean inster(House house) {
        return this.houseMapper.inster(house);
    }

    /**
     * 获取data
     * @param queryAnalyzer
     * @return
     */
    @Override
    public List<Map<String,Object>> queryAll(QueryAnalyzer queryAnalyzer) {
        return this.houseMapper.queryAll(queryAnalyzer);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @Override
    @Transactional
    public boolean delete(Integer id) {
        return this.houseMapper.delete(id);
    }

    /**
     * 获取单条
     * @param id
     * @return
     */
    @Override
    public House queryOne(Integer id) {
        return this.houseMapper.queryOne(id);
    }

    /**
     * 更新 data
     * @param house
     * @return
     */
    @Override
    public boolean updata(House house) {
        return this.houseMapper.updata(house);
    }

    /**
     *查询所有/委托/投放/联合办公-数量
     * @return
     */
    @Override
    public Map<String, Object> querySum() {
        return this.houseMapper.querySum();
    }

    /**
     * 楼盘下有多少房源
     * @param building_id
     * @return
     */
    @Override
    public Integer querySumHouse(Integer building_id) {
        return this.houseMapper.querySumHouse(building_id);
    }
}
